home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
001
/
pibt3sp4.arc
/
YESNO.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1985-07-28
|
2KB
|
60 lines
(*----------------------------------------------------------------------*)
(* YesNo --- Prompt for and read Yes/No question/answer *)
(*----------------------------------------------------------------------*)
FUNCTION YesNo( YesNo_Question : AnyStr ) : BOOLEAN;
(*----------------------------------------------------------------------*)
(* *)
(* Function: YesNo *)
(* *)
(* Purpose: Prompt for and read Yes/No question/answer *)
(* *)
(* Calling Sequence: *)
(* *)
(* Yes_Answer := YesNo( YesNo_Question : AnyStr ) : BOOLEAN; *)
(* *)
(* YesNo_Question --- Text of Yes/No question to be asked *)
(* Yes_Answer --- Set TRUE if "Yes" answer given, else *)
(* set FALSE. *)
(* *)
(* Calls: None *)
(* *)
(*----------------------------------------------------------------------*)
VAR
Ans_Ch: CHAR;
X : INTEGER;
Y : INTEGER;
BEGIN (* YesNo *)
WRITELN;
X := WhereX;
Y := WhereY;
Ans_Ch := ' ';
REPEAT
GoToXY( X , Y );
ClrEol;
WRITE( YesNo_Question );
READ( Kbd , Ans_Ch );
Ans_Ch := UpCase( Ans_Ch );
UNTIL( Ans_Ch IN ['Y','N'] );
IF Ans_Ch = 'Y' THEN
BEGIN
YesNo := TRUE;
WRITE('Yes');
END
ELSE
BEGIN
YesNo := FALSE;
WRITE('No');
END;
END (* YesNo *);